home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-27 | 2.8 KB | 147 lines | [TEXT/CWIE] |
- // NextMenus.c
- //
- // Copyright © 1997 Rob & Jon, MacHack '97
- //-------------------------------------------------------------------
-
- #include "NextMenus.h"
-
-
- void drawHead( Str255 inTitle, Rect inRect )
- {
- RGBColor currColor;
- Rect currRect = inRect;
-
- // make sure that the pen is ducky
- PenNormal();
-
- // draw the background, black
- setForeColor( kBlack );
-
- PaintRect( &currRect );
-
-
- // draw the outline; gray top, black & white bottom
- setForeColor( kLtGray );
-
- MoveTo( inRect.left, inRect.bottom );
- LineTo( inRect.left, inRect.top );
- LineTo( inRect.right, inRect.top );
-
- MoveTo( inRect.right-1, inRect.top );
- LineTo( inRect.right-1, inRect.bottom-1 );
- LineTo( inRect.left, inRect.bottom-1 );
-
- setForeColor( kBlack );
-
- MoveTo( inRect.right, inRect.top+1 );
- LineTo( inRect.right, inRect.bottom );
- LineTo( inRect.left, inRect.bottom );
-
- // draw the text, white
- setForeColor( kWhite );
-
- TextFont( helvetica );
- TextFace( bold );
- TextSize( 12 );
- MoveTo(currRect.left+4, currRect.bottom-4);
-
- DrawString( inTitle );
-
-
- PenNormal();
-
- }// drawHead()
-
-
- void drawMenu( Str255 inTitle, char inCmdKey, Boolean inHasSub, Boolean inHilite, Rect inRect )
- {
- RGBColor currColor;
- Point triStart;
- int midV;
-
- // make sure that the pen is ducky
- PenNormal();
-
- // draw the background, gray or white
- if( inHilite )
- setForeColor( kWhite );
- else
- setForeColor( kLtGray );
-
- PaintRect( &inRect );
-
- PenSize( 1, 1 );
-
- // draw the outline; white top, black bottom
- setForeColor( kWhite );
-
- MoveTo( inRect.left, inRect.bottom );
- LineTo( inRect.left, inRect.top );
- LineTo( inRect.right, inRect.top );
-
- setForeColor( kBlack );
-
- MoveTo( inRect.right, inRect.top+1 );
- LineTo( inRect.right, inRect.bottom );
- LineTo( inRect.left, inRect.bottom );
-
-
- // draw the text, dark gray
- setForeColor( kDkGray );
-
- TextFont( helvetica );
- TextFace( normal );
- TextSize( 12 );
- MoveTo(inRect.left+4, inRect.bottom-3);
-
- DrawString( inTitle );
-
- // if there is no submenu and there is a cmd key, draw the cmd key
- if( ! inHasSub )
- {
- if( inCmdKey != ' ' )
- {
- unsigned char theCmd[3];
-
- theCmd[0] = 1;
- theCmd[1] = inCmdKey;
- MoveTo(inRect.right-15, inRect.bottom-3);
- DrawString( theCmd );
- }
- }
- else
- {
- // there is a submenu so draw the triangle
- setForeColor( kDkGray );
-
- midV = inRect.top + ((inRect.bottom - inRect.top) / 2);
- SetPt( &triStart, inRect.right-15, midV+3 );
-
- MoveTo( triStart.h, triStart.v);
- LineTo( triStart.h, triStart.v-6 );
- LineTo( triStart.h+6, triStart.v-3 );
- setForeColor( kWhite );
- LineTo( triStart.h, triStart.v );
- }
-
-
- PenNormal();
-
- }// drawMenu()
-
-
- void setForeColor( short inColor )
- {
- RGBColor currColor;
-
- currColor.red = inColor;
- currColor.green = inColor;
- currColor.blue = inColor;
-
- RGBForeColor( &currColor );
-
- }// setForeColor()
-
-
-
-